package com.aaa.controller;

import com.aaa.service.ProductService;
import com.aaa.vo.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/12/28 10:04
 * @Description
 */
@RestController
@RequestMapping("/jd/product")
@CrossOrigin
@Slf4j
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping
    public CommonResult add(String keyword) {
        return productService.export(keyword);
    }

    @GetMapping("search/{keyword}")
    public CommonResult search(@PathVariable String keyword,Integer currentPage ,Integer size) {
        log.info("key = {} , page = {} , size = {}",keyword,currentPage,size);
        return productService.search(keyword,currentPage ,size );
    }
}
